<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="按钮" onclick="click1()"><br>
<input type="button" value="按钮1" id="btn1"><br>

姓名：<input type="text" id="name1" ><br>
姓名：<input type="text" id="name2" ><br>
<input type="button" id="btn2"  value="点击复制"><br>


<img src="../img/1.jpg" alt="" id="pic" width="400px"><br>
<input type="button" value="按钮1" id="b1" onclick="clickMe(this)">
<hr>
<br>
<input type="text" id="user"><span id="info" style="color: red"></span>

</body>
</html>
<script type="text/javascript">
    function clickMe(obj) {
        alert(obj.value);  //按钮对象
    }

    function click1() {
        alert("点击了")
    }
    window.onload = function (ev) {
        document.getElementById("btn1").onclick =function () {
            alert("点击率")
        }
        document.getElementById("btn2").onclick = function () {
            document.getElementById("name2").value =  document.getElementById("name1").value
        }
        document.getElementById("btn2").ondblclick = function (ev1) {
            document.getElementById("name1").value="";
            document.getElementById("name2").value="";
        }
    // document.getElementById("pic").onmouseover = function (ev1) {
    //         // document.getElementById("pic").src="../img/2.jpg";
    //     this.src="../img/2.jpg";
    //
    // }
    //     document.getElementById("pic").onmouseout = function (ev1) {
    //         // document.getElementById("pic").src="../img/2.jpg";
    //         this.src="../img/3.jpg";
    //
    //     }

        document.getElementById("user").onblur = function () {
            document.getElementById("info").innerText = "内容不能为空·"
        }
        document.getElementById("user").onfocus = function () {
            document.getElementById("info").innerText = "";
        }


    }
</script>
